time and space complexity of maximum and minimum